const {User} = require('../../model/user');
module.exports = async (req,res)=>{
    //记录当前访问的页面
    req.app.locals.currentLink = 'user';
    const { message, id } = req.query;
    //id存在则是修改操作
    if(id){
        let user = await User.findOne({_id: id});
        res.render('admin/user-edit',{
            message : message,
            user: user,
            link: '/admin/user-modify?id='+id,
            button: '修改'
        })
    }else{
        res.render('admin/user-edit',{
            message : message,
            link: '/admin/user-edit',
            button: '添加'

        })
    }

}